package com.huizluo.module3.list;

import java.util.HashMap;

public class FindCommand extends Command{

    private Store database;

    public FindCommand(String commandName, String commandDesc,Store database) {
        super(commandName,commandDesc);
        this.database = database;
    }

    @Override
    public void notise(){
        System.out.println("请输入学生信: id=xx");
    }

    @Override
    public void run(HashMap<String, String> args) throws Exception {
        int id = Integer.parseInt(args.get("id"));
        if ( id == 0 ){
            throw new Exception("参数错误");
        }
        Item item = this.database.Find(id);
        Student s = (Student)item.obj;
        System.out.println(s);
    }
}
